package queue;

import lombok.extern.slf4j.Slf4j;

import java.util.Iterator;
import java.util.PriorityQueue;
@Slf4j
public class Properity {
    public static void heapSort(int[] arr) {
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for (int value : arr) {
            queue.offer(value);
        }
        Iterator<Integer> iterator = queue.iterator();
        while (iterator.hasNext()) {
            log.info("排序后的数据：{}", queue.poll());
        }
    }

    public static void main(String[] args) {
        int[] arr = new int[]{28, 8, 10, 23, 21, 19, 9};
        log.info("要排序的初始化数据：{}", arr);
        //从小到大排序
        heapSort(arr);
    }


}
